export function fmoney(s, n)
{
  n = n > 0 && n <= 20 ? n : 2;
  s = parseFloat((s + "").replace(/[^\d\.-]/g, "")).toFixed(n) + "";
  var l = s.split(".")[0].split("").reverse(),
    r = s.split(".")[1];
  var t = "";
  for(var i = 0; i < l.length; i ++ )
  {
    t += l[i] + ((i + 1) % 3 == 0 && (i + 1) != l.length ? "," : "");
  }
  return t.split("").reverse().join("") + "." + r;
}
export function solveDate(date) {
  var week = "周日";
  date = parseInt(date);
  switch(date) {
    case 2:
      week = "周一";
      break;
    case 3:
      week = "周二";
      break;
    case 4:
      week = "周三";
      break;
    case 5:
      week = "周四";
      break;
    case 6:
      week = "周五";
      break;
    case 7:
      week = "周六";
      break;
  }
  return week;
}
export function toDecimal2(x) {
  var f = parseFloat(x);
  if (isNaN(f)) {
    return false;
  }
  var f = Math.round(x * 100) / 100;
  var s = f.toString();
  var rs = s.indexOf('.');
  if (rs < 0) {
    rs = s.length;
    s += '.';
  }
  while (s.length <= rs + 2) {
    s += '0';
  }
  return s;
}
